//
//  DeckCellFormatter.m
//  AnimatedFlashcards
//
//  Created by Timothy Costa on 10/28/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "DeckCellFormatter.h"


@implementation DeckCellFormatter

- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error
{
	if ([string compare:@""]==NSOrderedSame || !anObject) // This prevents the original from being discarded
		return NO;
	
	*anObject = [NSDictionary dictionaryWithObject:string forKey:@"name"];
	return YES;
}
- (NSString *)stringForObjectValue:(id)anObject
{
    if (![anObject isKindOfClass:[NSDictionary class]])
        return nil;
    return [anObject valueForKey:@"name"];
}
- (NSAttributedString*)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attrs
{
	if (![anObject isKindOfClass:[NSDictionary class]])
        return nil;
    NSAttributedString * anAttributedString = [[NSAttributedString alloc]initWithString: [anObject valueForKey:@"name"]];
	
	return anAttributedString;
}
@end
